package com.wei.czz.framework.game.controller;

import com.wei.czz.common.annotation.Auth;
import com.wei.czz.common.dto.game.GameFlowDto;
import com.wei.czz.common.jsr303.group.Search;
import com.wei.czz.common.tool.PageDto;
import com.wei.czz.common.vo.game.GameFlowFormVo;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import com.wei.czz.framework.game.service.GameFlowService;

import com.wei.czz.common.tool.Result;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2023-03-23 16:09:31
 * className: GameFlowController
 * version: 1.0
 * description:
 */
@RestController
@RequestMapping("/game-flow")
@AllArgsConstructor
public class GameFlowController {

    private static final Logger log = LoggerFactory.getLogger(GameFlowController.class);

    private final GameFlowService gameFlowService;

    /**
     * 分页查询游戏流水接口
     * <p>
     * 调用方：
     *  1、浏览器-后台管理页-游戏管理页-游戏流水弹出框调用
     * @param gameFlowFormVo 参数对象
     * @return 游戏流水分页数据
     */
    @PostMapping("/page/list")
    @Auth(permit = "game:list")
    public Result<PageDto<GameFlowDto>> pageGameFlowList(
            @Validated(Search.class) @RequestBody GameFlowFormVo gameFlowFormVo) {
        log.info("开始分页查询游戏流水业务。{}", gameFlowFormVo);

        PageDto<GameFlowDto> pageDto = gameFlowService.pageGameFlowList(gameFlowFormVo);

        log.info("分页查询游戏流水业务结束");
        return Result.success(pageDto);
    }

}
